<!-- 主页面路由 -->
<template>
  <div class="home">
    <ly-tab v-model="selectedId" @change='subRouterUrl' :items='items' :options='options'></ly-tab>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data () {
    return {
      selectedId: 0,
      items: [{
        label: '热门'
      }, {
        label: '服饰'
      }, {
        label: '鞋包'
      },
      {
        label: '母婴'
      },
      {
        label: '百货'
      }, {
        label: '食品'
      },
      {
        label: '内衣'
      }, {
        label: '男鞋'
      }, {
        label: '电器'
      }],
      options: {
        activeColor: '#e9232c'
      },
      // 配置二级路由路径
      secondRouter: [
        '/home/hot',
        '/home/clothes',
        '/home/shoeBag',
        '/home/infant',
        '/home/store',
        '/home/food',
        '/home/underwear',
        '/home/manShoes',
        '/home/electric'
      ]
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created () {

  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted () {

  },
  methods: {
    subRouterUrl (value, index) {
      this.$router.replace(this.secondRouter[index])
    }
  }
}
</script>
<style lang="stylus" scoped>
.home
  width 100%
  height auto
.ly-tab
 z-index 10000
</style>
